package com.rnerp;

import com.facebook.react.ReactActivity;
import android.view.KeyEvent; 
import com.github.kevinejohn.keyevent.KeyEventModule;

import android.os.Bundle; // here
// react-native-splash-screen >= 0.3.1
import org.devio.rn.splashscreen.SplashScreen;
public class MainActivity extends ReactActivity {

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "RNERP";
    }
    @Override  
    public boolean onKeyDown(int keyCode,KeyEvent event) {
      KeyEventModule.getInstance().onKeyDownEvent(keyCode, event);
      super.onKeyDown(keyCode, event);
      return true;
    }

    @Override 
    public boolean onKeyUp(int keyCode, KeyEvent event) {
      KeyEventModule.getInstance().onKeyUpEvent(keyCode, event);
      super.onKeyUp(keyCode, event);
      return true;
    }
    @Override
    public boolean onKeyMultiple(int keyCode,int repeatCount, KeyEvent event) {
        KeyEventModule.getInstance().onKeyMultipleEvent(keyCode, repeatCount, event);
        return super.onKeyMultiple(keyCode, repeatCount, event);
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        SplashScreen.show(this);  // here
        super.onCreate(savedInstanceState);
    }
}
